package com.ctbri.manage.quality.example;
import com.ctbri.manage.quality.single.*;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

public class DataInputTest {
    public static void main(String[] args){
        CheckColumnType checkColumnType = new CheckColumnType(
                "JavaSparkDemo",
                "local[*]",
                "Warn",
                "jdbc:mysql://localhost:3306/MyfirstDatabase?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC",
                "com.mysql.cj.jdbc.Driver",
                "root",
                "xiaosonggege1025",
                "score",
                "",
                ""
        );
        SparkSession spark = checkColumnType.envSet(
                checkColumnType.getAppname(),
                checkColumnType.getMasterSet(),
                checkColumnType.getLogLevel()
        );
        Dataset<Row> result = checkColumnType.getDataFromJdbc(
                spark,
                checkColumnType.getUrl(),
                checkColumnType.getDriver(),
                checkColumnType.getUser(),
                checkColumnType.getPassword(),
                checkColumnType.getDbtable()
        );
        result.show();
    }
}
